<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt" %>


<%@ page import="sg.edu.nus.iss.cats.model.*"%>
<fmt:setBundle basename="ApplicationResources" />
             
<jsp:useBean id="userBean" class="sg.edu.nus.iss.cats.javabean.UsersBean"/>
  
<%
      String userId = request.getParameter("user_id");
     //Get user details 
     User user = userBean.getUserInfo(userId);       
     pageContext.setAttribute("user",user);

%>

<html>
<head>
    <title><fmt:message key="title.application"/></title>
    
    <link rel="STYLESHEET" type="text/css" href="<%= request.getContextPath() %>/css/style.css">
</head>
<%@ include file="/header.jsp" %>

<h2>Edit User Details</h2>

<form name="userForm" method="post" action="<%= request.getContextPath() %>/admin/modify">
<table>
    <tr>
        <td>User Id:</td>
        <td colspan="3">
        ${user.userId}
        <input type="hidden" name="userId" value="${user.userId}">
        </td>
    </tr>
    <tr>
        <td>Name:</td>
        <td colspan="3">
        <input type="text" name="name" size="40" value="${user.name}">
            
         </td>
    </tr>
    <tr>
        <td>Password:</td>
        <td colspan="3">
            <input type="text" name="password" size="40" value="${user.password}">
         </td>
    </tr>
    <tr>
        <td>Employee Id:</td>
        <td colspan="3">
         <input type="text" name="employeeId" size="40" value="${user.employeeId}">
         </td></tr>
         
   <tr><td>Roles:</td>
       <td colspan="3">

           <select name="roleIds" multiple="multiple" size="4">   
                <%= userBean.getRolesMenu(user) %>     
           </select>

        </td>
   </tr>
   <tr><td>&nbsp;</td>
    <td colspan="2" align="left"><br></br>
        <button type="submit">
       <img src="<%= request.getContextPath() %>/img/button_submit.gif" alt="Submit" align="middle">
        </button>&nbsp;
        <a href="javascript:history.back();">
        <img src="<%= request.getContextPath() %>/img/button_cancel.gif" alt="" align="absmiddle" border="0">
        </a>
     </td>
   </tr>
 </table>
</form>
    
 
  <%@ include file="/footer.jsp" %>
 

